#ifndef TEXTURE_GS
#define TEXTURE_GS

cbuffer per_frame : register(b0)
{
	matrix world;
	matrix view_proj;
	float3 pos;
	float3 size;
};

struct texture_ps_input
{
	float4 sv_pos : SV_POSITION;
	float3 pos : POSITION;
	float2 tex : TEXCOORD;
};

// Define an empty struct because it is required to have some kind of inputstruct here
struct no_input{};

[maxvertexcount(4)]
void texture_gs(point no_input input[1], inout TriangleStream<texture_ps_input> p_stream)
{
	texture_ps_input output = (texture_ps_input)0;

	float3 n_size = size * 0.5f;

	float3 position = pos;//mul(float4(pos, 1.0f), world);
	
	output.pos = position;
	output.pos.x -= n_size.x;
	output.pos.y -= n_size.y;
	output.sv_pos = float4(output.pos.xyz, 1.0f);
	output.tex = float2(0.0f,1.0f);
	p_stream.Append(output);
	
	output.pos = position;
	output.pos.x += n_size.x;
	output.pos.y -= n_size.y;
	output.sv_pos = float4(output.pos.xyz, 1.0f);
	output.tex = float2(1.0f,1.0f);
	p_stream.Append(output);
	
	
	output.pos = position;
	output.pos.x -= n_size.x;
	output.pos.y += n_size.y;
	output.sv_pos = float4(output.pos.xyz, 1.0f);
	output.tex = float2(0.0f,0.0f);
	p_stream.Append(output);
	
	output.pos = position;
	output.pos.x += n_size.x;
	output.pos.y += n_size.y;
	output.sv_pos = float4(output.pos.xyz, 1.0f);
	output.tex = float2(1.0f,0.0f);
	p_stream.Append(output);
}
#endif